home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16916 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: fsgi01.fnal.gov!not-for-mail
  2. From: b91926@fsgi01.fnal.gov (David Sachs)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Virtual function does not make any sense unless it is pure.
  5. Date: 12 Apr 1996 13:36:47 -0500
  6. Organization: FERMILAB, Batavia, IL
  7. Message-ID: <4km7rv$6uh@fsgi01.fnal.gov>
  8. References: <4kkhbc$nj4@brahms.udel.edu>
  9. Reply-To: sachs@fnal.fnal.gov
  10. NNTP-Posting-Host: fsgi01.fnal.gov
  11. X-Newsreader: NN version 6.5.0 #9 (NOV)
  12.  
  13. yuehong@brahms.udel.edu (Yue-hong Zheng) writes:
  14.  
  15.  
  16. >Can any body give me any examples to show non-pure virtual function does 
  17. >make sense?
  18.  
  19. One common situation, where a non-pure virtual function is desirable,
  20. is when the function for the derived class adds to rather than replaces
  21. the action of the base class function. In such cases the derived
  22. class function at some point calls the base class function. This could
  23. call a chain of calls, in which a virtual function call calls a function
  24. in the most derived class, which calls the same function in its base
  25. class ...
  26.  
  27. There are many situations in which this occurs: cloning an object,
  28. operating on a complex graphic object ...
  29.  
  30. non-pur virtual function are probably more common than pur ones.
  31. -- 
  32. ***** The stories about the first lady are hilarious. *****
  33. David Sachs - Fermilab, HPPC MS369 - P. O. Box 500 - Batavia, IL 60510
  34. Voice: 1 708 840 3942      Deparment Fax: 1 708 840 3785
  35.